package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Checkgroup;
import com.itheima.pojo.SetmealGroup;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SetmealGroupMapper extends BaseMapper<SetmealGroup> {
    @Select("select group_id from setmeal_group_t where setmeal_id = #{id}")
    Long[] findGroupBySid(Long id);

    @Select("select setmeal_id from setmeal_group_t where group_id = #{gid}")
    Long[] findSetmealByGid(Long gid);

    @Select("select st.setmeal_id from checkgroupitem_t ct\n" +
            "right join setmeal_group_t st on st.group_id = ct.group_id\n" +
            "where ct.item_id  = 1 group by st.setmeal_id\n")
    Long[] findSetmealByCid(Long cid);
}
